package com.ruoyi;

import com.ruoyi.nettysocket.SocketServer1;
import com.ruoyi.nettywebsockt.WebSocketServer;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.Ordered;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@Order(value = Ordered.HIGHEST_PRECEDENCE)
public class MyApplicationRunner implements ApplicationRunner {

    @Autowired
    private SocketServer1 socketServer1;

    @Autowired
    private WebSocketServer webSocketServer;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        //启动SocketServer1服务端
        socketServer1.startSocketServer();

        //启动websocket服务端
        webSocketServer.startWebSocketServer();
    }


}
